package com.car.account.controller;

import com.car.account.util.aliyunUtil.AliyunOssUtil;
import com.car.commons.core.model.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * 上传图片
 */
@RestController
@RequestMapping("/update")
@Api(tags = "上传图片")
public class UpImageController {

    @Resource
    private AliyunOssUtil aliyunOssUtil;

    @PostMapping("/updateImage.ty")
    @ApiOperation(value = "上传图片，swagger不可用")
    public Result<String> updateImage(MultipartFile mf)throws Exception{
        String imageName = aliyunOssUtil.upImage(mf);
        return Result.getResult(String.class).setMsg("上传图片成功").setData(imageName);
    }

}
